package com.excel2sql.chenjun.ui;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.filechooser.FileNameExtensionFilter;

public class FileChooseWindow extends JFrame
{
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -4175894183131859858L;

	private CustomFileChooser customFileChooser;

	public void showWindow()
	{
		customFileChooser = new CustomFileChooser();
		FileNameExtensionFilter filter = new FileNameExtensionFilter("xls和xlsx文件", "xls", "xlsx");
		customFileChooser.setFileFilter(filter);
		JPanel jPanel = new JPanel();
		this.add(jPanel);
		jPanel.add(customFileChooser);
		super.setTitle("sql生成工具-选择文件");
		super.setBounds(320, 170, 800, 600);

		this.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				super.windowClosing(e);
			}
		});

		this.setVisible(true);
	}

	public static void main(String[] args)
	{
		FileChooseWindow fileChooseWindow = new FileChooseWindow();
		fileChooseWindow.showWindow();
	}
}
